<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link href="../reset.css" rel="stylesheet"/>
        <link href="./style.css" rel="stylesheet"/>

        <title>MixItUp Demo - Insertion with Non-target Elements</title>
    </head>
    <body>
        <div class="controls">
            <button type="button" class="control" data-sort="default:asc">Asc</button>
            <button type="button" class="control" data-sort="default:desc">Desc</button>
        </div>

        <div class="container" data-ref="container">
            <button type="button" class="item button" data-ref="button-add-new"></button>

            <div class="gap"></div>
            <div class="gap"></div>
            <div class="gap"></div>
        </div>

        <script src="../mixitup.min.js"></script>

        <script>
            var containerEl  = document.querySelector('[data-ref="container"]');
            var buttonAddNew = document.querySelector('[data-ref="button-add-new"]');

            var mixer = mixitup(containerEl, {
                selectors: {
                    target: '[data-ref="mixitup-target"]'
                }
            });

            buttonAddNew.addEventListener('click', function() {
                mixer.insertAfter('<div class="item" data-ref="mixitup-target"></div>', buttonAddNew);
            });
        </script>
    </body>
</html>